import net from 'net'
import { Pipe } from './pipe'

const server = net.createServer()

server.listen(6666, () => {
	console.log('Server is running on port 6666')
})

server.on('connection', (socket) => {
	const pipe = new Pipe()

	socket.on('data', (buffer) => {
		pipe.push(buffer)
	})

	pipe.on('data', (data) => {
		console.log('data:', data.toString())
	})
})
